import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'

// https://vite.dev/config/
export default defineConfig({
    plugins: [vue()],
    server: {
        host: '0.0.0.0', // 解决“vite use `--host` to expose”
        port: 8080, // 前端项目端口
        open: false // 启动时自动打开浏览器运行前端项目
    },
    resolve: {
        alias: [
            {
                find: '@',
                replacement: resolve(__dirname, './src')
            }
        ]
    },
    devServer: {
        host: '0.0.0.0',
        port: 8888,
        disableHostCheck: true, // 避免Host检查
        proxy: {
            '/api': {
                target: 'http://192.168.31.132:8888', // 替换为实际IP
                changeOrigin: true
            }
        }
    }
})

